package com.sebastian.studies.ch9_Course;

public class Course {

	private String courseName;
	private String[] students = new String[50];
	private int numberOfStudent;

	public Course(String courseName) {
		super();
		this.courseName = courseName;
	}

	public String[] getStudents() {
		return students;
	}

	public int getNumberOfStudent() {
		return numberOfStudent;
	}

	public String getCourseName() {
		return courseName;
	}

	public void addStudent(String student) {
		students[numberOfStudent] = student;
		numberOfStudent++;
	}

	public void listStudents(Course course, String[] students) {
		for (int i = 0; i < course.numberOfStudent; i++) {
			System.out.println(students[i]);
		}
	}

//	public void dropStudent(String student, String[] students, Course course) {
//		int newNumberOfStudents = course.numberOfStudent;
//		String[] newArray = new String[newNumberOfStudents];
//
//		//replacing matched String with ""
//		for (int i = 0; i < course.numberOfStudent; i++) {
//			if (students[i].equals(student)) {
//				students[i] = "";
//				newNumberOfStudents--;
//			}
//		}
//		
//		for (int i = 0; i < course.numberOfStudent; i++) {
//			if (!students[i].isEmpty()) {
//				System.out.println(i);
//				for (int j = 0; j < newNumberOfStudents; j++) {
//					newArray[j] = students[i];
//				}
//				
//			}
//		}
//		listStudents(course, newArray);
//	}

	public void dropStudent(String student) {
//		int pointer = 0;
//		String[] kurwa = getStudents();
//		for (int i = 0; i < getStudents().length; i++) {
//			if(kurwa[i].equals(student)) {
//				pointer = i;
//			}
//		}
		students[numberOfStudent] = student;
		numberOfStudent--;
//		for (int i = 0; i < studentsAfterDrop.length; i++) {
//			
//		}
	}
}
